package br.com.alinesoftware.app.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.hibernate.annotations.ForeignKey;

@MappedSuperclass
public abstract class EtiquetaQRCode implements Serializable {

	private static final long serialVersionUID = 5547848953831173773L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "SE_ETIQUETA_QRCODE")
	@Column(nullable = false, length = 5)
	private Long id;

	@NotNull
	@Size(max = 255)
	@Column
	private String descLocalInsercao;

	@NotNull
	@Size(max = 255)
	@Column
	private String referenciaMesa;

	@NotNull
	@Column(length = 11)
	@Temporal(TemporalType.TIMESTAMP)
	private Date dataCriacao;

	@ManyToOne(targetEntity = ClienteEntity.class, fetch = FetchType.LAZY)
	@ForeignKey(name = "FK_ETIQQRCODE_CRIAETIQ")
	@NotNull
	@JoinColumn
	private Cliente criadorEtiqueta;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getDescLocalInsercao() {
		return descLocalInsercao;
	}

	public void setDescLocalInsercao(String descLocalInsercao) {
		this.descLocalInsercao = descLocalInsercao;
	}

	public String getReferenciaMesa() {
		return referenciaMesa;
	}

	public void setReferenciaMesa(String referenciaMesa) {
		this.referenciaMesa = referenciaMesa;
	}

	public Date getDataCriacao() {
		return dataCriacao;
	}

	public void setDataCriacao(Date dataCriacao) {
		this.dataCriacao = dataCriacao;
	}

	public Cliente getCriadorEtiqueta() {
		return criadorEtiqueta;
	}

	public void setCriadorEtiqueta(Cliente criadorEtiqueta) {
		this.criadorEtiqueta = criadorEtiqueta;
	}

}
